﻿using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using System;
using System.Collections.Generic;

namespace Coldairarrow.Entity
{
    [Map(typeof(Base_User))]
    public partial class Base_UserDTO : Base_User
    {
        public string RowName { get; set; }
        public string RoleNames { get => string.Join(",", RoleNameList ?? new List<string>()); }
        public List<string> RoleIdList { get; set; }
        public List<string> RoleNameList { get; set; }
        public RoleTypes RoleType
        {
            get
            {
                int type = 0;

                var values = typeof(RoleTypes).GetEnumValues();
                foreach (var aValue in values)
                {
                    if (RoleNames.Contains(aValue.ToString()))
                        type += (int)aValue;
                }

                return (RoleTypes)type;
            }
        }
        public string FactoryName { get; set; }
        public string DepartmentName { get; set; }
        /// <summary>
        /// 外协单位ID
        /// </summary>
        public string SupplierId { get; set; }
        public string SexText { get => Sex.GetDescription(); }
        public string BirthdayText { get => Birthday?.ToString("yyyy-MM-dd"); }
        public List<string> DeptIds { get; set; }
        /// <summary>
        /// 原打印机（弃用）
        /// </summary>
        public string Printer { get; set; }
        /// <summary>
        /// 当前用户隶属的打印机列表
        /// </summary>
        public List<Printers> PrinterList { get; set; }

        public string Roid { get; set; }
    }

    /// <summary>
    /// 打印机列表
    /// </summary>
    public class Printers 
    {
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 打印机名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 类型ID
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// 类型名称
        /// </summary>
        public string TypeName { get; set; }

        /// <summary>
        /// 当前状态：0=正常；1-故障
        /// </summary>
        public int Status { get; set; }
    }

    public partial class Base_UserItemDTO : Base_User
    {

        public string TempNmae { get; set; }
        public string TempId { get; set; }
        public DateTime dispatchDate { get; set; }
        public string RowName { get; set; }
        public string RoleNames { get => string.Join(",", RoleNameList ?? new List<string>()); }
        public List<string> RoleIdList { get; set; }
        public List<string> RoleNameList { get; set; }
        public RoleTypes RoleType
        {
            get
            {
                int type = 0;

                var values = typeof(RoleTypes).GetEnumValues();
                foreach (var aValue in values)
                {
                    if (RoleNames.Contains(aValue.ToString()))
                        type += (int)aValue;
                }

                return (RoleTypes)type;
            }
        }
        public string FactoryName { get; set; }
        public string DepartmentName { get; set; }
        /// <summary>
        /// 外协单位ID
        /// </summary>
        public string SupplierId { get; set; }
        public string SexText { get => Sex.GetDescription(); }
        public string BirthdayText { get => Birthday?.ToString("yyyy-MM-dd"); }
        public List<string> DeptIds { get; set; }
        /// <summary>
        /// 原打印机（弃用）
        /// </summary>
        public string Printer { get; set; }
        /// <summary>
        /// 当前用户隶属的打印机列表
        /// </summary>
        public List<Printers> PrinterList { get; set; }
    }
}
